/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.community.model.vo;

import cn.ac.nercis.pes.common.constant.project.FinishState;
import javafx.beans.property.*;
import javafx.collections.ObservableList;

/**
 * 菜单视图模型
 * @author zpy
 * @version 1.0.0
 */
public class MenuVO {
    private final SimpleIntegerProperty id = new SimpleIntegerProperty();
    private final SimpleStringProperty code = new SimpleStringProperty();
    private final SimpleStringProperty title = new SimpleStringProperty();
    private final SimpleStringProperty icon = new SimpleStringProperty();
    private final SimpleStringProperty cssStyle = new SimpleStringProperty();
    private final SimpleStringProperty toolTip = new SimpleStringProperty();
    private final SimpleBooleanProperty error = new SimpleBooleanProperty();
    private final SimpleObjectProperty<FinishState> state = new SimpleObjectProperty<>();
    private final SimpleObjectProperty<Object> data = new SimpleObjectProperty<>();
    private final SimpleListProperty<MenuVO> children = new SimpleListProperty<>();

    public MenuVO(int id, String code, String title, String icon){
        this(id,code,title,icon,"","");
    }

    public MenuVO(int id, String code, String title, String icon, String cssStyle, String toolTip){
        this.setId(id);
        this.setCode(code);
        this.setTitle(title);
        this.setIcon(icon);
        this.setCssStyle(cssStyle);
        this.setToolTip(toolTip);
        this.setError(false);
    }

    public int getId() {
        return id.get();
    }

    public SimpleIntegerProperty idProperty() {
        return id;
    }

    public void setId(int id) {
        this.id.set(id);
    }

    public String getCode() {
        return code.get();
    }

    public SimpleStringProperty codeProperty() {
        return code;
    }

    public void setCode(String code) {
        this.code.set(code);
    }

    public String getTitle() {
        return title.get();
    }

    public SimpleStringProperty titleProperty() {
        return title;
    }

    public void setTitle(String title) {
        this.title.set(title);
    }

    public String getIcon() {
        return icon.get();
    }

    public SimpleStringProperty iconProperty() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon.set(icon);
    }

    public String getCssStyle() {
        return cssStyle.get();
    }

    public SimpleStringProperty cssStyleProperty() {
        return cssStyle;
    }

    public void setCssStyle(String cssStyle) {
        this.cssStyle.set(cssStyle);
    }

    public String getToolTip() {
        return toolTip.get();
    }

    public SimpleStringProperty toolTipProperty() {
        return toolTip;
    }

    public void setToolTip(String toolTip) {
        this.toolTip.set(toolTip);
    }

    public boolean isError() {
        return error.get();
    }

    public SimpleBooleanProperty errorProperty() {
        return error;
    }

    public void setError(boolean error) {
        this.error.set(error);
    }

    public FinishState getState() {
        return state.get();
    }

    public SimpleObjectProperty<FinishState> stateProperty() {
        return state;
    }

    public void setState(FinishState state) {
        this.state.set(state);
    }

    public Object getData() {
        return data.get();
    }

    public SimpleObjectProperty<Object> dataProperty() {
        return data;
    }

    public void setData(Object data) {
        this.data.set(data);
    }

    public ObservableList<MenuVO> getChildren() {
        return children.get();
    }

    public SimpleListProperty<MenuVO> childrenProperty() {
        return children;
    }

    public void setChildren(ObservableList<MenuVO> children) {
        this.children.set(children);
    }
}